package view;

import javax.swing.*;
import java.awt.*;

/***
 * Author: Mr.Zhao, Time: 2018/5/6/14:57
 * Description: 主界面
 */
public class MainFrame extends JFrame {
    private ChessBoard chessBoard = null;
    private FindPlayerPanel findPlayerPanel = null;

    public MainFrame() {
        chessBoard = ChessBoard.getInstance();
        findPlayerPanel = new FindPlayerPanel();

        setLayout(null);
        chessBoard.setLocation(0, 0);
        findPlayerPanel.setLocation(chessBoard.getWidth(), chessBoard.getMargin());
        add(chessBoard);
        add(findPlayerPanel);

        setSize(chessBoard.getWidth() + findPlayerPanel.getWidth() + (int) (chessBoard.getMargin() * 1.5),
                chessBoard.getHeight() + chessBoard.getMargin());
        setLocationRelativeTo(null);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setTitle("中国象棋");
        setResizable(false);
        setVisible(true);
    }

    public FindPlayerPanel getFindPlayerPanel() {
        return findPlayerPanel;
    }

    public ChessBoard getChessBoard() {
        return chessBoard;
    }

}
